$(function(){
			   				
	$.getJSON("json/yuedu.json",{},function(data){
		for(var i=0;i<data.length;i++){
			var $newdiv=$("#temp").clone(true);
			//console.log(data[i].mediaList["0"].title);
			$newdiv.find(".title").html("书名："+data[i].mediaList["0"].title);
			$newdiv.find(".descs").html("简介："+data[i].mediaList["0"].descs);
			$newdiv.find(".author").html("作者："+data[i].mediaList["0"].authorPenname);
			//console.log(data[i].mediaList["0"].coverPic);
			$newdiv.find("img").attr("src",data[i].mediaList["0"].coverPic).addClass("newimg");
			$newdiv.show();
			$("#d1").append($newdiv);								
		}	
		$("#d1").append("<div class='end'>（完）</div>");
		
	});		

	
	
	$.getJSON("json/remen.json",{},function(remendata){
		//$("#d1").append("<div class='end'>（完）</div>");
		for(var i=0;i<remendata.length;i++){
			var $newdiv=$("#temp").clone(true);
			//console.log(remendata[i].mediaList["0"].title);
			$newdiv.find(".title").html("书名："+remendata[i].mediaList["0"].title);
			$newdiv.find(".descs").html("简介："+remendata[i].mediaList["0"].descs);
			$newdiv.find(".author").html("作者："+remendata[i].mediaList["0"].authorPenname);
			//console.log(remendata[i].mediaList["0"].coverPic);
			$newdiv.find("img").attr("src",remendata[i].mediaList["0"].coverPic).addClass("newimg");
			$newdiv.show();
			$("#d2").append($newdiv);
		}	
		$("#d2").append("<div class='end'>（完）</div>");
		var st = document.body.scrollTop||document.documentElement.scrollTop;
    	var ch = document.body.clientHeight||document.documentElement.clientHeight;		
		$(".newimg").each(
		    function(){
		        var imgtop = $(this).offset().top;	
		        if(imgtop>st&&imgtop<st+ch-50){
		        	console.log(imgtop+" "+ st+" "+ ch);
		        	$(this).removeClass();
		            $(this).addClass("oldimg");		                            
		            $(this).attr("src",$(this).attr("src2"));
		        }
		});	
		
	});		
	$.getJSON("json/haoping.json",{},function(haopingdata){
		for(var i=0;i<haopingdata.length;i++){
			var $newdiv=$("#temp").clone(true);
			//console.log(haopingdata[i].mediaList["0"].title);
			$newdiv.find(".title").html("书名："+haopingdata[i].mediaList["0"].title);
			$newdiv.find(".descs").html("简介："+haopingdata[i].mediaList["0"].descs);
			$newdiv.find(".author").html("作者："+haopingdata[i].mediaList["0"].authorPenname);
			//console.log(haopingdata[i].mediaList["0"].coverPic);
			$newdiv.find("img").attr("src",haopingdata[i].mediaList["0"].coverPic).addClass("newimg");
			$newdiv.show();
			$("#d3").append($newdiv);
		}			
		$("#d3").append("<div class='end'>（完）</div>");
	});	
	
		
});
	
	